home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / dropDeformersReorder.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.9 KB  |  100 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  26 Feb 1996
  22. //  Author:         ms
  23. //
  24. //  Description:
  25. //      This procedure is a callback for the drag/drop on deformers
  26.  
  27. global proc dropDeformersReorder( string $dragged, string $drop, string $msgs[],
  28.                                   int $x, int $y, int $type )
  29. {
  30.     if( $dragged == $drop ) return;
  31.     if( size($msgs) < 1 ) return;
  32.     if( "deformersReorder" != $msgs[0] ) return;
  33.  
  34.     global string $gHistoryWindowNode;
  35.  
  36.     string $nameDragged = "";
  37.     string $nameDropped = "";
  38.     string $annDragged = "";
  39.     string $annDropped = "";
  40.     string $object = "";
  41.     string $tmpobj = "";
  42.     int $future = false;
  43.     string $tmp[];
  44.     int $n;
  45.  
  46.     if( "staticText" == `objectTypeUI $dragged` ) {
  47.         $annDragged = `text -q -ann $dragged`;
  48.     }
  49.     if( "staticText" == `objectTypeUI $drop` ) {
  50.         $annDropped = `text -q -ann $drop`;
  51.     }
  52.  
  53.     if( ("" != $annDragged) && ("" != $annDropped) ) {
  54.         tokenize( $annDropped, "|", $tmp );
  55.         $n = size($tmp);
  56.         if( $n > 2 ) {
  57.             $object = $tmp[0];
  58.             for( $i=1; $i<($n-2); $i+=1 ) {
  59.                 $object = $object + "|" + $tmp[$i];
  60.             }
  61.             if( "future" == $tmp[$n-2] ) {
  62.                 $future = true;
  63.             }
  64.             $nameDropped = $tmp[$n-1];
  65.  
  66.             tokenize( $annDragged, "|", $tmp );
  67.             $n = size($tmp);
  68.             if( $n > 2 ) {
  69.                 $tmpobj = $tmp[0];
  70.                 for( $i=1; $i<($n-2); $i+=1 ) {
  71.                     $tmpobj = $tmpobj + "|" + $tmp[$i];
  72.                 }
  73.  
  74.                 $nameDragged = $tmp[$n-1];
  75.  
  76.                 if( $tmpobj != $object ) {
  77.                     warning( "Mismatched deformer targets" );
  78.                 }
  79.             }
  80.             else {
  81.                 error( "bad name of the dragged item." );
  82.             }
  83.         }
  84.         else {
  85.             error( "bad name of the dropped item." );
  86.         }
  87.     }
  88.  
  89.     if( ("" != $nameDragged) && ("" != $nameDropped) ) {
  90.         // Force the window to rebuild itself even though the selection
  91.         // has not changed
  92.         $gHistoryWindowNode = "";
  93.         
  94.         evalEcho( "reorderDeformers \"" + $nameDropped +
  95.                   "\" \"" + $nameDragged + "\" \"" + $object + "\"" );
  96.         evalDeferred( "historyPopupFill \"" + $object + "\" " + $future + " 2");
  97.     }
  98. }
  99.  
  100.